package com.example.houseman.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 装修类型
 *
 * @author lzj
 */
@Getter
public enum DecorationType {
    HARDCOVER("精装", 0),
    PAPERBACK("简装", 1),
    BLANK("毛坯", 2);

    @JsonValue
    private String name;
    @EnumValue
    private int index;

    private DecorationType(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (DecorationType c : DecorationType.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

}
